package com.ruoyi.web.controller.system;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.AdminLuckyRecord;
import com.ruoyi.system.service.IAdminLuckyRecordService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 澳洲开奖记录管理Controller
 *
 * @author ruoyi
 * @date 2021-06-20
 */
@RestController
@RequestMapping("/system/luckRecord")
public class AdminLuckyRecordController extends BaseController
{
    @Autowired
    private IAdminLuckyRecordService adminLuckyRecordService;

    /**
     * 查询澳洲开奖记录管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:luckRecord:list')")
    @GetMapping("/list")
    public TableDataInfo list(AdminLuckyRecord adminLuckyRecord)
    {
        startPage();
        List<AdminLuckyRecord> list = adminLuckyRecordService.selectAdminLuckyRecordList(adminLuckyRecord);
        return getDataTable(list);
    }

    /**
     * 导出澳洲开奖记录管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:luckRecord:export')")
    @Log(title = "澳洲开奖记录管理", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(AdminLuckyRecord adminLuckyRecord)
    {
        List<AdminLuckyRecord> list = adminLuckyRecordService.selectAdminLuckyRecordList(adminLuckyRecord);
        ExcelUtil<AdminLuckyRecord> util = new ExcelUtil<AdminLuckyRecord>(AdminLuckyRecord.class);
        return util.exportExcel(list, "luckRecord");
    }

    /**
     * 获取澳洲开奖记录管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:luckRecord:query')")
    @GetMapping(value = "/{recordId}")
    public AjaxResult getInfo(@PathVariable("recordId") Long recordId)
    {
        return AjaxResult.success(adminLuckyRecordService.selectAdminLuckyRecordById(recordId));
    }

    /**
     * 新增澳洲开奖记录管理
     */
    @PreAuthorize("@ss.hasPermi('system:luckRecord:add')")
    @Log(title = "澳洲开奖记录管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AdminLuckyRecord adminLuckyRecord)
    {
        return toAjax(adminLuckyRecordService.insertAdminLuckyRecord(adminLuckyRecord));
    }

    /**
     * 修改澳洲开奖记录管理
     */
    @PreAuthorize("@ss.hasPermi('system:luckRecord:edit')")
    @Log(title = "澳洲开奖记录管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AdminLuckyRecord adminLuckyRecord)
    {
        return toAjax(adminLuckyRecordService.updateAdminLuckyRecord(adminLuckyRecord));
    }

    /**
     * 删除澳洲开奖记录管理
     */
    @PreAuthorize("@ss.hasPermi('system:luckRecord:remove')")
    @Log(title = "澳洲开奖记录管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{recordIds}")
    public AjaxResult remove(@PathVariable Long[] recordIds)
    {
        return toAjax(adminLuckyRecordService.deleteAdminLuckyRecordByIds(recordIds));
    }
}
